
<template>
  <div style="height: calc(100vh - 120px)">
    <iframe
      ref="iframe"
      :src="src"
      width="100%"
      height="100%"
      frameborder="0"
      allowfullscreen
    />
  </div>
</template>
<script>
export default {
  data() {
    return {
      addon_name: ''
    }
  },
  computed: {
    src() {
      return process.env.VUE_APP_BASE_API + '/' + this.addon_name
    }
  },
  mounted() {
    this.addon_name = this.$route.query.addon_name
    this.$nextTick(() => {
      const iframe = this.$refs.iframe.contentWindow
      console.log(iframe)
      if (iframe) {
        iframe.postMessage({
          type: 'setStyle',
          style: {
            body: {
              width: 'calc(100% - 40px)',
              margin: '0 auto'
            }
          }
        }, '*')
      }
    })
  }
}
</script>

<style scoped lang="scss">
</style>
